#include <stdio.h>
#include <stdlib.h>
#include "bintree.h"

void fstorder(bnode *p);
int main()
{
    bnode *p;
    printf("Please enter Extended binary tree: ");
    p = creat();
    printf("The binary tree is: ");
    fstorder(p);
    return 0;
}

void fstorder(bnode *p)
{
    sqstack s;
    s.top=-1;
    while(p!=NULL||s.top!=-1)
    {
        if(p!=NULL)
        {
            printf("%6c",p->data);
            s.top++;
            s.data[s.top]=p;
            p=p->lch;
        }else
        {
            p=s.data[s.top];
            s.top--;
            p=p->rch;
        }
    }
}
